﻿using MP_Game.Protos.V1;

namespace MP_Network
{
    internal class ServerAuthCtrl : IContainer
    {
        public void OnServerCommand(ServerBase serverBase, GamePacket packet)
        {
            if (packet.CmdId == CmdId.CmdServerAuth)
            {
                ServerAuthReq req = ServerAuthReq.Parser.ParseFrom(packet.Data);
                if (req != null)
                {
                    if (serverBase != null && serverBase is Session)
                    {
                        serverBase._clientType = req.CliType;
                        SessionMgr.Instance.AddCli(req.CliType, (Session)serverBase);
                        LogMsg.Info(req.ToString());
                    }
                }
            }
        }
        public void OnClientCommand(ServerBase serverBase, GamePacket packet)
        {
        }

        public void OnInit()
        {
            LogMsg.Info("AuthCtrl 初始化完成...");
        }


    }
}
